Skip to content

test(vt-server): fix the flaky dead-client test - #682

Merged
wan9chi merged 1 commit into
mainfrom
claude/sharp-wozniak-de0ae9
Aug 18, 2026
Merged

test(vt-server): fix the flaky dead-client test#682
wan9chi merged 1 commit into
mainfrom
claude/sharp-wozniak-de0ae9

Conversation

@wan9chi

@wan9chi wan9chi commented Aug 17, 2026

Copy link
Copy Markdown
Member

Motivation

client_gone_before_reading_response_is_not_an_error failed now and then on Windows CI (example run), and passed when the same commit was re-run. CLAUDE.md says the suite has no flaky tests.

The two frames were not racing each other — the connection was never taken. On Windows a client gets the waiting pipe from the operating system before the server's accept sees it. This test's client waited for nothing, so it could finish while its connection was still unclaimed; the test helper then told the server to stop accepting, and with the stop and the waiting connection both ready, the server picks one at random. When the stop won, it dropped that pipe with both frames unread. Unix cannot land here, because a client there cannot finish connecting until the server has taken it.

What changed

The test now checks what the server promises — a client that dies mid-answer ends only its own stream — with each step forced rather than timed:

  • The dying client marks its request tracked, so the records prove the server handled it.
  • It reads only the four bytes of length in front of the answer. They arrive once the server has begun writing a body too big for any pipe buffer, so dropping the stream always leaves that write with no reader.
  • A second client, open across the death, is served while the first is stuck and again after it dies.

The DisableCache frame it used to lean on is gone — raw_disable_cache_request_disables_cache already covers that one. No production code changed.

🤖 Generated with Claude Code

`client_gone_before_reading_response_is_not_an_error` failed intermittently
on Windows CI. On Windows a client reaches a pipe instance before the
server's `accept` sees it, and this test's client waited for nothing before
its work ended, so the connection could still be unaccepted when the harness
signalled the server to stop accepting. The accept loop then had both the
stop signal and the pending accept ready, and `tokio::select!` picks among
ready branches at random; when the stop won, the server dropped that pipe
instance with both frames unread, so the flag the test asserted was never
recorded.

Rebuild the test around what the server promises. The dying client's request
is tracked, so the reports prove the handler ran. It reads only the answer's
length prefix, which arrives only once the server has started writing a body
far larger than any pipe buffer, so dropping the stream there always leaves
that write with no reader. A second client, open across the death, is served
both while the first is stuck and after it dies.

The `DisableCache` frame this test used to piggyback on is gone: it rode on a
connection about to die, which the server makes no promise about, and
`raw_disable_cache_request_disables_cache` already covers that frame.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.50%  [ -6.54% .. +11.38%]  overhead   +53.38%
dynamic/access             change  +1.18%  [ -5.60% .. +12.86%]  overhead    +5.83%
dynamic/access-relative    change  +0.00%  [ -3.94% ..  +2.53%]  overhead   +45.93%
static/launch              change  +1.66%  [ -7.60% .. +14.97%]  overhead  +145.27%
static/access              change  -1.84%  [-11.34% ..  +8.55%]  overhead  +824.63%
static/access-relative     change  -1.19%  [ -5.97% ..  +4.67%]  overhead +1321.74%

macos

dynamic/launch             change  +0.06%  [ -8.42% ..  +8.08%]  overhead  +222.82%
dynamic/access             change  +1.44%  [-22.47% .. +27.99%]  overhead   +11.11%
dynamic/access-relative    change  +0.93%  [-10.49% ..  +9.77%]  overhead  +263.61%

windows

dynamic/launch             change  -0.06%  [ -3.85% ..  +2.95%]  overhead   +27.35%
dynamic/access             change  +0.19%  [ -0.76% ..  +0.95%]  overhead    +1.50%
dynamic/access-relative    change  +0.00%  [ -0.73% ..  +0.92%]  overhead    +1.48%

@wan9chi wan9chi changed the title test(vt-server): make the dead-client test deterministic test(vt-server): fix the flaky dead-client test Aug 18, 2026
@wan9chi
wan9chi merged commit 15a9fb1 into main Aug 18, 2026
31 of 35 checks passed
@wan9chi
wan9chi deleted the claude/sharp-wozniak-de0ae9 branch August 18, 2026 02:29
wan9chi added a commit that referenced this pull request Aug 18, 2026
The two branches below moved onto current main, which brings in #682's
vt_server fix along the way.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

# Conflicts:
#	crates/fspy/src/ipc.rs
#	crates/fspy/src/unix/mod.rs
#	crates/fspy/src/windows/mod.rs
#	crates/vt_bin/tests/e2e_snapshots/fixtures/fspy_shm_capacity/snapshots.toml
#	crates/vt_bin/tests/e2e_snapshots/fixtures/fspy_shm_capacity/snapshots/shm_capacity_env_sizes_the_tracking_channel.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant